/*
 * timeops.c
 *
 *  Created on: Dec 3, 2010
 */
#include <time.h>
#include <stdio.h>

#include "timeops.h"

/**
 * Return the current real time. formated as a string with "<epocs>.<nsecs>"
 * @param szTimeStampString -- String for storing the time stamp. Min size is TIME_STAMP_STRING_SIZE this includes room for the  '\0'..
 * @return -- pointer to the szTimeStampString. which now contains a timestamp.
 */
char *TimeStamp(char *szTimeStampString) {
	struct timespec stTimeSpec;

	clock_gettime(CLOCK_REALTIME, &stTimeSpec);
	// TODO N Check return value.
	sprintf(szTimeStampString, "%012ld.%09ld", stTimeSpec.tv_sec, stTimeSpec.tv_nsec);
	return(szTimeStampString);
} // end timestamp
